package 刷题10月.每日一题0930;
// https://leetcode-cn.com/problems/minimum-moves-to-equal-array-elements/
public class 数学453最小操作次数使数组元素相等1020 {
    class Solution {
        public int minMoves(int[] nums) {
            int n = nums.length;
            long min = nums[0], sum = 0;
            for (int i : nums) {
                min = Math.min(min, i);
                sum += i;
            }
            return (int)(sum - min * n);
        }
    }

}
